package com.ssy.lingxi.purchase.repository.online;

import com.ssy.lingxi.purchase.entity.onlinebidding.OnLineBidding;
import com.ssy.lingxi.purchase.entity.onlinebidding.OnlineMateriel;
import com.ssy.lingxi.purchase.service.online.OnlineBiddinService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
*在线报价明细
* @author wrc
* @date 2020/7/8
*/
@Repository
public interface OnlineMaterielRepository extends JpaRepository<OnlineMateriel, Long> {

    Page<OnlineMateriel> findAllByOnlineBiddingId(Long id, Pageable page);

    List<OnlineMateriel>  findAllByOnlineBiddingId(Long id);

    List<OnlineMateriel>  findAllByOnlineBiddingIdAndIsSignUp(Long id, Integer isSignUp);

    List<OnlineMateriel>  findAllByOnlineBiddingIdAndIsOffer(Long id, Integer isOffer);

    OnlineMateriel  findByOnlineBiddingAndCreateMemberIdAndCreateMemberRoleId(OnLineBidding onLineBiding, Long memberId, Long memberRoleId);

    OnlineMateriel  findByOnlineBiddingAndCreateMemberIdAndCreateMemberRoleIdAndIsSignUp(OnLineBidding onLineBiding, Long memberId, Long memberRoleId, Integer isSignUp);

    OnlineMateriel  findByOnlineBiddingAndCreateMemberIdAndCreateMemberRoleIdAndIsOffer(OnLineBidding onLineBiding, Long memberId, Long memberRoleId, Integer isOffer);

    int countByOnlineBidding(OnLineBidding onLineBiding);
}
